<!DOCTYPE html>
<html>
<head>
	<meta content="text/html;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
	<meta http-equiv ="Pragma" content = "no-cache"/>
	<meta http-equiv="Cache-Control" content="no cache" />
	<meta http-equiv="Expires" content="0" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
	<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<meta name="format-detection" content="telephone=no"/>
	<script src="https://cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
	<link href="https://cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="/static/fsLayui-1.8.2/plugins/layui/css/layui.css" media="all"/>
	<link rel="stylesheet" type="text/css" href="/static/fsLayui-1.8.2/css/fs.css" media="all"/>
	<script type="text/javascript" src="/static/fsLayui-1.8.2/plugins/layui/layui.js"></script>
	<script type="text/javascript" src="/static/fsLayui-1.8.2/plugins/jquery/jquery.min.js"></script>
	<script type="text/javascript" src="/static/fsLayui-1.8.2/plugins/frame/js/fsDict.js?v=1.5.0"></script>
	<script type="text/javascript" src="/static/fsLayui-1.8.2/plugins/frame/js/fs.js?v=1.5.0"></script>
	<script type="text/javascript" src="/static/fsLayui-1.8.2/plugins/frame/js/frame.js?v=1.5.0"></script>
	<script type="text/javascript" src="/static/js/ckeditor/ckeditor.js"></script>
    <link rel="shortcut icon" href="/static/foreground/images/logo.png"
  type="image/x-icon" />
<!--Layui-->
<link href="/static/foreground/layui/css/layui.css" rel="stylesheet" />
<!--font-awesome-->
<link href="/static/foreground/font-awesome/css/font-awesome.min.css"
  rel="stylesheet" />
<!--全局样式表-->
<link href="/static/foreground/css/global.css" rel="stylesheet" />
<link href="/static/foreground/css/animate.min.css" rel="stylesheet" />
<!-- 本页样式表 -->
<link href="/static/foreground/css/index.css" rel="stylesheet" />
<link href="/static/css/blog.css" rel="stylesheet" />
<link rel="stylesheet" href="/static/APlayer/APlayer.min.css">
</head>
<body>
<!-- 导航 -->
  <div th:replace="common/head::#h"></div>
  <!-- 用户登陆 -->
  <div class="blog-user"></div>
  <!-- 主体（一般只改变这里的内容） -->
  <div class="blog-body">
    <div class="layui-carousel blog-bg" id="carousel">
      <div carousel-item="">
        <div class="bg bg_a"></div>
        <div class="bg bg_b"></div>
        <div class="bg bg_c"></div>
        <div class="bg bg_d"></div>
        <div class="bg bg_e"></div>
      </div>
    </div>
    <div class="blog-container">
      <div class="blog-main">
        <!-- 网站公告提示 -->
        <div class="home-tips shadow">
          <i style="float: left; line-height: 17px;" class="fa fa-volume-up"></i>
          <div class="home-tips-container">
            <span th:each="n : ${session.noticeList}" style="color: #009688"
              th:utext="${n.content}"></span>
          </div>
        </div>
	<div class="layui-fluid">
	<form class="layui-form" id="edit_form" isLoad="1">
	<input type="hidden" name="articleId"/>
	<input type="hidden" name="click"/>
	<input type="hidden" name="commentNum"/>
	<input type="hidden" name="imageName"/>
	<input type="hidden" id="imageName" name="imageName"/>
	  <div class="layui-form-item">
	    <label class="layui-form-label">文章标题</label>
	    <div class="layui-input-block">
	      <input type="text" name="title" required="" lay-verType="tips" lay-verify="required" placeholder="请输入笔记标题" autocomplete="off" class="layui-input"/>
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">作者</label>
	    <div class="layui-input-block">
	      <input type="text" name="author" required="" lay-verType="tips" lay-verify="required" placeholder="请输入笔记作者" autocomplete="off" class="layui-input"/>
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">笔记类别</label>
	    <div class="layui-input-block">
	      <select name="classify" lay-verify="required" lay-verType="tips" class="fsSelect" addNull="1"  dict="classify">
          <option th:each="classify:${list}" th:value="${classify.classifyId}" th:text="${classify.classifyName}"></option>
	      </select>
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">笔记属性</label>
	    <div class="layui-input-block">
	      <input type="checkbox" name="isTop" title="置顶" value="1" >
	      <input type="checkbox" name="isOriginal" title="原创" value="1">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">展示图片</label>
	  <div class="layui-upload">
		  <button type="button" class="layui-btn" id="test1">上传图片</button>
		  <div class="layui-upload-list">
		    <p id="demoText"></p>
		  </div>
		</div>
		</div>
		
		<div class="layui-form-item">
	    <label class="layui-form-label"></label>
	    <div class="layui-input-block">
	      <img class="layui-upload-img" id="demo1" name="imageName" style="width: 250px;height: 150px;" />
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">文章内容</label>
	    <div class="layui-input-block">
	      <textarea id="content" name="content" rows="30" cols="80" class="mytext"></textarea>
	    </div>
	  </div>
	  <hr/>
	  <div class="layui-form-item" style="text-align: center;">
     	 <button class="layui-btn " lay-submit="" lay-filter="save" url="/addNote">提交</button>
<!--      	  <button class="layui-btn" lay-submit="" lay-filter="save" url="/fsbus/1006">保存</button> -->
     	  
     	 <button type="button" class="layui-btn layui-btn-primary"><a href="/"><i class="fa fa-info fa-fw"></i>&nbsp;关闭</a></button>
    </div>
</form>
	</div>
	
<script>
layui.use('upload', function(){
  var $ = layui.jquery
  ,upload = layui.upload;
  
  //普通图片上传
  var uploadInst = upload.render({
    elem: '#test1'
    ,url: '/upload'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo1').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
      //如果上传失败
      if(res.code > 0){
        return layer.msg('上传失败');
      }
      $('#imageName').val(res.data.filePath); //图片链接（base64）
      //上传成功
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
});

$(window).load(function(){
	setTimeout(images, 200);
});
function images(){
	var str=$('#imageName').val();
	 $("#demo1").attr("src","/static/images/"+str);
}
</script>
</body>
</html>
